<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 1.分析下列代码

function Student(name,age){
    this.name = '张静',
    this.age = 26
}
var person = new Student('周飘',16)

console.log('姓名:'+person.name+'年龄:'+person.age)
var collection = {
    "1275":{
        "album":"依然范特西",
        "artist":"周杰伦",
        "tracks":[
            "听妈妈的话",
            "千里之外"
        ]
},
    "2468":{
        "album":"西界",
        "artist":"林俊杰",
        "tracks":[
            "西界",
            "杀手"
        ]
},
    "3245":{
        "artist":"许嵩",
        "tracks":[ ]
    },
    "5439":{
        "album":"遇见"
    }
}

// 1.定义方法更新记录:
function updateRecords(id,prop,value){
        if (prop=='tracks') {
          collection[id][prop]=value
        }else{
          collection[id][prop]=value
        }
        if (value=='') {
          delete collection[id][prop]
        }
    }
// 要求：
// 1).如果传入的value是一个空值，表示将该属性删除
// 2).传入的prop如果是tracks，则代表添加，其他是修改


// 3245 tracks '有何不可'
// 3245 tracks ''   -->删
// 5439 artist '孙燕姿'
// 5439 album '逆光
        </script>
</body>
</html>